package javaCode.chapter10.enum_;

/**
 * @author 徐州城
 * @version 1.0
 */
public class Enumeration03 {
    public static void main(String[] args) {
        System.out.println(Season2_.AUTUMN);
        System.out.println(Season2_.SUMMER);
    }
}

//演示使用 enum关键字来实现枚举
enum Season2_ { //类

    //定义了四个对象，固定.
//    public final static Season_ SPRING = new Season_("春天","温暖");
//    public final static Season_ SUMMER = new Season_("夏天","炎热");
//    public final static Season_ AUTUMN = new Season_("秋天","凉爽");
//    public final static Season_ WINTER = new Season_("冬天","寒冷");

    //如果使用了 enum来实现枚举
    //1. 使用 enum 代替 class
    //2. public final static Season_ SPRING = new Season_("春天","温暖");
    //   直接写成 SPRING("春天","温暖")  解读  常量名(实参列表)
    //3. 如果有多个常量(对象)  使用,号间隔即可
    //4. 如果使用enum 来实现枚举，要求将定义的常量对象，写在前面
    //5. 如果我们使用的是无参构造器，创建常量对象，则可以省略 () 比如：WHAT(); --> WHAT;
    SPRING("春天", "温暖"), SUMMER("夏天", "炎热"), AUTUMN("秋天", "凉爽"), WINTER("冬天", "寒冷");
    private String name;
    private String desc; //描述

    private Season2_(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return "Season_{" +
                "name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                '}';
    }
}
